"""
存放项目中需要的fixture
"""
from interface.member import MemberInterface
from interface.cart import CartInterface
from interface.order import OrderInterface
import pytest

# 在fixture中,1.fixture之间可以相互引用;
# 2.低级别的fixture可以引用高级别的fixture;高级别的fixture不能引用低级别的fixture
body = {
        "username": "jack",
        "password": "123456"
    }

# @pytest.fixture(scope='session')
# def url(url='http://47.108.206.100:8085'):  # 将环境设置成为fixture
#     return url


@pytest.fixture(scope='session')
def headers():  # 将会员登录的token,组合成headers,设置为会话级别
    return MemberInterface().get_token(body)

@pytest.fixture()
def cart(headers):  # 购物车
    return CartInterface(headers)

@pytest.fixture()
def order(headers):  # 订单
    return OrderInterface(headers)
